package com.springboot.uav.config;


import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * Created by IntelliJ IDEA.
 * &#064;Author : Zys
 * &#064;create 2024/11/5 13:29
 */

/**
 * http://localhost:8080/swagger-ui/index.html
 */
@Configuration

public class Swagger3Config {

    // 第一个模块:用户
    @Bean
    public GroupedOpenApi UserApi()
    {
        return GroupedOpenApi.builder().group("用户API").pathsToMatch("/user/**").build();
    }
    @Bean
    public GroupedOpenApi AddressApi(){
        return GroupedOpenApi.builder().group("地址API").pathsToMatch("/address/**").build();
    }
    @Bean
    public GroupedOpenApi OrdersApi(){
        return GroupedOpenApi.builder().group("订单API").pathsToMatch("/orders/**").build();
    }
    @Bean
    public GroupedOpenApi MypageApi(){
        return GroupedOpenApi.builder().group("我的页面API").pathsToMatch("/mypage/**").build();
    }

    @Bean
    public OpenAPI springShopOpenAPI() {
        return new OpenAPI()
                .info(new Info().title("快递代拿项目")
                        .description("描述")
                        .version("v1.0")
                        .license(new License().name("Apache 2.0").url("http://springdoc.org")))
                .externalDocs(new ExternalDocumentation()
                        .description("SpringShop Wiki Documentation")
                        .url("https://springshop.wiki.github.org/docs"));

    }

}
